#include "./getShortcutKeys.hpp"

#include "../../src/ql/common/json/settingjsonparsing.h"
#include "../ui_message/message.h"

namespace qbe {

bool getKeyPressed(std::string mode, std::string name, ecs::Bus& bus) {
  auto keys = bus.receive<qbe::UiMessage::Shortcut_key>();

  auto keyString = SettingJsonParsing::getInstance()->getShortcutKeys(mode, name);

  for (auto key : keys) {
    if (key.key == keyString) {
      return true;
    }
  }

  return false;
}

}  // namespace qbe